<!doctype html>
<html lang="ru" data-bs-theme="dark">

<head>
    <!-- 2024-05-09 13:11:45 -->
        <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Git - gittutorial 2</title>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css" integrity="sha512-jnSuA4Ss2PkkikSOLtYs8BlYIeeIK1h99ty4YfvRPAlzr377vr3CXDb7sb7eEEBYjDtcYj+AjBH3FLv5uSJuXg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css" integrity="sha512-dPXYcDub/aeb08c63jRq/k6GaKccl256JQy/AnOq7CAnEZ9FzSL9wSbcZkMp4R26vBsMLFYH4kQ67/bbV8XaCQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css" integrity="sha512-rO+olRTkcf304DQBxSWxln8JXCzTHlKnIdnMUwYvQa9/Jd4cQaNkItIUj6Z4nvW1dqK0SKXLbn9h4KwZTNtAyw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/7.1.0/css/flag-icons.min.css" integrity="sha512-bZBu2H0+FGFz/stDN/L0k8J0G8qVsAL0ht1qg5kTwtAheiXwiRKyCq1frwfbSFSJN3jooR5kauE0YjtPzhZtJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link href="../../../runebook.css" rel="stylesheet" type="text/css">
    <meta name="x-github" content="https://github.com/runebookdev/runebook">
            <meta name="x-i18n-doc" content="git">
        <script>
        function i18n(element) {
            // NOP
        }
    </script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/3.0.5/js.cookie.js" integrity="sha512-F/dia2jKME12jwqiYDayeD+Rr/8jTWUD2wfbuJB0bzSwenSEnXsn4qQ/wVyXUCix5bmCAj8xJdtFr2OqUtjLAw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js" integrity="sha512-7Pi/otdlbbCR+LnW+F7PwFcSDJOuUJB3OxtEHbg4vSMvzvJjde4Po1v4BR9Gdc9aXNUNFVUY+SK51wWT8WF0Gg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/7.8.1/rxjs.umd.min.js" integrity="sha512-D9LDs8YUUVa4V9Gl4Zb+xqRAc7RCzooR3+zzebgK2RMu/KU+dh90pbjEEMzPiSyRSGbSp9j1pZnrO4joGa5WEg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha512-mhbv5DqBMgrWL+32MmsDOt/OAvqr/cHimk6B8y/bx/xS88MVkYGPiVv2ixKVrkywF2qHplNRUvFsAHUdxZ3Krg==" crossorigin="anonymous"></script>
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6424571640879890" crossorigin="anonymous"></script>    <script async src="https://www.googletagmanager.com/gtag/js?id=G-3G5BZ1QEDP"></script>
<script>
    window.dataLayer = window.dataLayer || [];

    function gtag() {
        dataLayer.push(arguments);
    }

    gtag('js', new Date());
    gtag('config', 'G-3G5BZ1QEDP');
</script>    <script>
(function(c, l, a, r, i, t, y) {
    c[a] = c[a] || function() {
        (c[a].q = c[a].q || []).push(arguments)
    };
    t = l.createElement(r);
    t.async = 1;
    t.src = "https://www.clarity.ms/tag/" + i + "?ref=bwt";
    y = l.getElementsByTagName(r)[0];
    y.parentNode.insertBefore(t, y);
})(window, document, "clarity", "script", "jto2hd94r9");
</script>    <script src="../../../theme.js"></script>
</head>

<body>
    <header class="bg-black">
        <div class="container">
            <div class="row">
                <div class="col">
                    <nav class="navbar navbar-expand-lg navbar-dark">
                        <a class="navbar-brand fw-bold" href="https://runebook.dev/ru">
                            <img alt="Runebook.dev" class="d-inline-block align-top mr-1" src="../../../assets/runebook_logo.webp" width="24" height="24">
                            Runebook.dev
                        </a>
                        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                            <span class="navbar-toggler-icon"></span>
                        </button>
                        <div class="collapse navbar-collapse" id="navbarSupportedContent">
                            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                                <li class="nav-item">
                                    <a class="nav-link" href="https://runebook.dev/ru#docs">Documentation</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="https://runebook.dev/contributors">Contributors</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="https://github.com/runebookdev/runebook/issues">GitHub</a>
                                </li>
                            </ul>
                                                                                                <button class="btn btn-success ms-2" id="showPopupButton">
                                        <i class="bi bi-translate"></i>
                                        Show English
                                    </button>
                                                                                        <div class="form-check form-switch ms-3">
                                <label class="text-light">
                                    <input class="form-check-input" type="checkbox" role="switch" id="theme-switch" checked>
                                    <i class="bi bi-moon-stars-fill"></i>
                                </label>
                            </div>
                        </div>
                    </nav>
                </div>
            </div>
        </div>
    </header>

    <!--sse-->
    <div class="container">
    <div class="row">
        <div class="col">
            <nav aria-label="breadcrumb" class="mt-2">
                <ol class="breadcrumb mb-1">
                    <li class="breadcrumb-item">
                        <a href="https://runebook.dev/ru#docs">
                            <span class="fi fi-ru"></span>                            Русский                        </a>
                    </li>
                    <li class="breadcrumb-item">
                        <a href="-index-.html">
                            Git                            2.43                        </a>
                    </li>
                                            <li class="breadcrumb-item">
                            <a href="-index-.html#Miscellaneous">
                                Miscellaneous                            </a>
                        </li>
                                    </ol>
            </nav>
        </div>
    </div>
    <br>

    <div class="row">
        <div class="col-md-9">
            <main>
                <article>

                    
                    <h1 class="text-body-emphasis" ><span data-i18n="b9c51f296546f440c3df22ddfc61eb1924219107ba1e5c4421f32ea40caae604/c8" data-source="gittutorial-2" onmousemove="i18n(this)">gittutorial-2</span></h1> <h2 class="text-body-emphasis"  id="_name"><span data-i18n="dcd1d5223f73b3a965c07e3ff5dbee3eedcfedb806686a05b9b3868a2c3d6d50/3a" data-source="Name" onmousemove="i18n(this)">Name</span></h2> <div> <p><span data-i18n="6df43e15d64a08bfcfe1c7ebb190d97d72c306b79e7bca1f79c0c56df7f0ed77/8b" data-source="gittutorial-2 - A tutorial introduction to Git: part two" onmousemove="i18n(this)">gittutorial-2 &mdash; &Vcy;&vcy;&iecy;&dcy;&iecy;&ncy;&icy;&iecy; &vcy; Git: &chcy;&acy;&scy;&tcy;&softcy; &vcy;&tcy;&ocy;&rcy;&acy;&yacy;</span></p> </div> <h2 class="text-body-emphasis"  id="_synopsis"><span data-i18n="8eb3755381519d7f0479d75446e56e20084834c0460d7ec94926932372ea6c47/0d" data-source="Synopsis" onmousemove="i18n(this)">Synopsis</span></h2> <div> <div> <pre class="hljs language-undefined">git *</pre> </div> </div> <h2 class="text-body-emphasis"  id="_description"><span data-i18n="526e0087cc3f254d9f86f6c7d8e23d954c4dfda2b312efc29194ae8a860106ba/d3" data-source="Description" onmousemove="i18n(this)">Description</span></h2> <div> <p><span data-i18n="4d58eec3c29f38522f9bae2009ac12466185bdc79f57c76bb3f652f7ece2cedc/0e" data-source="You should work through &lt;a href=&quot;gittutorial&quot;&gt;gittutorial[7]&lt;/a&gt; before reading this tutorial." onmousemove="i18n(this)">&Pcy;&rcy;&iecy;&zhcy;&dcy;&iecy; &chcy;&iecy;&mcy; &chcy;&icy;&tcy;&acy;&tcy;&softcy; &ecy;&tcy;&ocy; &rcy;&ucy;&kcy;&ocy;&vcy;&ocy;&dcy;&scy;&tcy;&vcy;&ocy;, &vcy;&acy;&mcy; &scy;&lcy;&iecy;&dcy;&ucy;&iecy;&tcy; &pcy;&ocy;&rcy;&acy;&bcy;&ocy;&tcy;&acy;&tcy;&softcy; &scy;  <a href="gittutorial.html">gittutorial[7]</a> .</span></p> <p><span data-i18n="92cbf4879242c1e4f92a691c8a5e8e382832f0d5b190a433dd2017a29d94bece/b8" data-source="The goal of this tutorial is to introduce two fundamental pieces of Git&amp;rsquo;s architecture&amp;mdash;&amp;ZeroWidthSpace;the object database and the index file&amp;mdash;&amp;ZeroWidthSpace;and to provide the reader with everything necessary to understand the rest of the Git documentation." onmousemove="i18n(this)">&TScy;&iecy;&lcy;&softcy; &ecy;&tcy;&ocy;&gcy;&ocy; &rcy;&ucy;&kcy;&ocy;&vcy;&ocy;&dcy;&scy;&tcy;&vcy;&acy; &mdash; &pcy;&rcy;&iecy;&dcy;&scy;&tcy;&acy;&vcy;&icy;&tcy;&softcy; &dcy;&vcy;&iecy; &fcy;&ucy;&ncy;&dcy;&acy;&mcy;&iecy;&ncy;&tcy;&acy;&lcy;&softcy;&ncy;&ycy;&iecy; &chcy;&acy;&scy;&tcy;&icy; &acy;&rcy;&khcy;&icy;&tcy;&iecy;&kcy;&tcy;&ucy;&rcy;&ycy;  Git  &mdash; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ncy;&ucy;&yucy; &bcy;&acy;&zcy;&ucy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy; &icy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ycy;&jcy; &fcy;&acy;&jcy;&lcy; &mdash; &icy; &pcy;&rcy;&iecy;&dcy;&ocy;&scy;&tcy;&acy;&vcy;&icy;&tcy;&softcy; &chcy;&icy;&tcy;&acy;&tcy;&iecy;&lcy;&yucy; &vcy;&scy;&iecy; &ncy;&iecy;&ocy;&bcy;&khcy;&ocy;&dcy;&icy;&mcy;&ocy;&iecy; &dcy;&lcy;&yacy; &pcy;&ocy;&ncy;&icy;&mcy;&acy;&ncy;&icy;&yacy; &ocy;&scy;&tcy;&acy;&lcy;&softcy;&ncy;&ocy;&jcy; &chcy;&acy;&scy;&tcy;&icy; &dcy;&ocy;&kcy;&ucy;&mcy;&iecy;&ncy;&tcy;&acy;&tscy;&icy;&icy;  Git .</span></p> </div> <h2 class="text-body-emphasis"  id="_the_git_object_database"><span data-i18n="f8b0e0b36954597aa62a43200a1ee07660114e987230eb4cc94910e05f5acbb8/c4" data-source="The git object database" onmousemove="i18n(this)">&Ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ncy;&acy;&yacy; &bcy;&acy;&zcy;&acy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy;  git</span></h2> <div> <p><span data-i18n="94781d1c205ccbe147161dc07383c397f00e4eb09fee65716d90bbac552bd87b/c3" data-source="Let&amp;rsquo;s start a new project and create a small amount of history:" onmousemove="i18n(this)">&Dcy;&acy;&vcy;&acy;&jcy;&tcy;&iecy; &ncy;&acy;&chcy;&ncy;&iecy;&mcy; &ncy;&ocy;&vcy;&ycy;&jcy; &pcy;&rcy;&ocy;&iecy;&kcy;&tcy; &icy; &scy;&ocy;&zcy;&dcy;&acy;&dcy;&icy;&mcy; &ncy;&iecy;&bcy;&ocy;&lcy;&softcy;&shcy;&ocy;&jcy; &ocy;&bcy;&hardcy;&iecy;&mcy; &icy;&scy;&tcy;&ocy;&rcy;&icy;&icy;:</span></p> <div> <div> <pre class="hljs language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">mkdir</span> test-project</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">cd</span> test-project</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">git init</span>
Initialized empty Git repository in .git/
<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">&apos;hello world&apos;</span> &gt; file.txt</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">git add .</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">git commit -a -m <span class="hljs-string">&quot;initial commit&quot;</span></span>
[master (root-commit) 54196cc] initial commit
 1 file changed, 1 insertion(+)
 create mode 100644 file.txt
<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">&apos;hello world!&apos;</span> &gt;file.txt</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">git commit -a -m <span class="hljs-string">&quot;add emphasis&quot;</span></span>
[master c4d59f3] add emphasis
 1 file changed, 1 insertion(+), 1 deletion(-)</pre> </div> </div> <p><span data-i18n="61bcebe8f71d83f7b886dc54a704e48fce231f04be8ac93283b3068f2fb3fcba/6a" data-source="What are the 7 digits of hex that Git responded to the commit with?" onmousemove="i18n(this)">&Kcy;&acy;&kcy;&icy;&iecy; 7 &shcy;&iecy;&scy;&tcy;&ncy;&acy;&dcy;&tscy;&acy;&tcy;&iecy;&rcy;&icy;&chcy;&ncy;&ycy;&khcy; &tscy;&icy;&fcy;&rcy;  Git  &ocy;&tcy;&vcy;&iecy;&tcy;&icy;&lcy; &ncy;&acy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy;?</span></p> <p><span data-i18n="8eb2a7ab49de096a5f8617e8d63ffda9caf4b81ecaa2fbc908ce3d1e41aa6b5f/19" data-source="We saw in part one of the tutorial that commits have names like this. It turns out that every object in the Git history is stored under a 40-digit hex name. That name is the SHA-1 hash of the object&amp;rsquo;s contents; among other things, this ensures that Git will never store the same data twice (since identical data is given an identical SHA-1 name), and that the contents of a Git object will never change (since that would change the object&amp;rsquo;s name as well). The 7 char hex strings here are simply the abbreviation of such 40 character long strings. Abbreviations can be used everywhere where the 40 character strings can be used, so long as they are unambiguous." onmousemove="i18n(this)">&Vcy; &pcy;&iecy;&rcy;&vcy;&ocy;&jcy; &chcy;&acy;&scy;&tcy;&icy; &rcy;&ucy;&kcy;&ocy;&vcy;&ocy;&dcy;&scy;&tcy;&vcy;&acy; &mcy;&ycy; &vcy;&icy;&dcy;&iecy;&lcy;&icy;, &chcy;&tcy;&ocy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ycy; &icy;&mcy;&iecy;&yucy;&tcy; &tcy;&acy;&kcy;&icy;&iecy; &icy;&mcy;&iecy;&ncy;&acy;. &Ocy;&kcy;&acy;&zcy;&ycy;&vcy;&acy;&iecy;&tcy;&scy;&yacy;, &kcy;&acy;&zhcy;&dcy;&ycy;&jcy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy; &vcy; &icy;&scy;&tcy;&ocy;&rcy;&icy;&icy;  Git  &khcy;&rcy;&acy;&ncy;&icy;&tcy;&scy;&yacy; &pcy;&ocy;&dcy; 40-&zcy;&ncy;&acy;&chcy;&ncy;&ycy;&mcy; &shcy;&iecy;&scy;&tcy;&ncy;&acy;&dcy;&tscy;&acy;&tcy;&iecy;&rcy;&icy;&chcy;&ncy;&ycy;&mcy; &icy;&mcy;&iecy;&ncy;&iecy;&mcy;. &Ecy;&tcy;&ocy; &icy;&mcy;&yacy; &pcy;&rcy;&iecy;&dcy;&scy;&tcy;&acy;&vcy;&lcy;&yacy;&iecy;&tcy; &scy;&ocy;&bcy;&ocy;&jcy; &khcy;&ecy;&shcy; SHA-1 &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ocy;&gcy;&ocy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&acy;; &scy;&rcy;&iecy;&dcy;&icy; &pcy;&rcy;&ocy;&chcy;&iecy;&gcy;&ocy;, &ecy;&tcy;&ocy; &gcy;&acy;&rcy;&acy;&ncy;&tcy;&icy;&rcy;&ucy;&iecy;&tcy;, &chcy;&tcy;&ocy;  Git  &ncy;&icy;&kcy;&ocy;&gcy;&dcy;&acy; &ncy;&iecy; &bcy;&ucy;&dcy;&iecy;&tcy; &khcy;&rcy;&acy;&ncy;&icy;&tcy;&softcy; &ocy;&dcy;&ncy;&icy; &icy; &tcy;&iecy; &zhcy;&iecy; &dcy;&acy;&ncy;&ncy;&ycy;&iecy; &dcy;&vcy;&acy;&zhcy;&dcy;&ycy; (&pcy;&ocy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ucy; &icy;&dcy;&iecy;&ncy;&tcy;&icy;&chcy;&ncy;&ycy;&mcy; &dcy;&acy;&ncy;&ncy;&ycy;&mcy; &pcy;&rcy;&icy;&scy;&vcy;&acy;&icy;&vcy;&acy;&iecy;&tcy;&scy;&yacy; &icy;&dcy;&iecy;&ncy;&tcy;&icy;&chcy;&ncy;&ocy;&iecy; &icy;&mcy;&yacy; SHA-1) &icy; &chcy;&tcy;&ocy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ocy;&iecy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&acy;  Git  &ncy;&icy;&kcy;&ocy;&gcy;&dcy;&acy; &ncy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&icy;&tcy;&scy;&yacy; (&pcy;&ocy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ucy; &ecy;&tcy;&ocy; &tcy;&acy;&kcy;&zhcy;&iecy; &pcy;&rcy;&icy;&vcy;&iecy;&dcy;&iecy;&tcy; &kcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yucy; &icy;&mcy;&iecy;&ncy;&icy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&acy;). ). 7 &shcy;&iecy;&scy;&tcy;&ncy;&acy;&dcy;&tscy;&acy;&tcy;&iecy;&rcy;&icy;&chcy;&ncy;&ycy;&khcy; &scy;&tcy;&rcy;&ocy;&kcy;  char  &zcy;&dcy;&iecy;&scy;&softcy; &yacy;&vcy;&lcy;&yacy;&yucy;&tcy;&scy;&yacy; &pcy;&rcy;&ocy;&scy;&tcy;&ocy; &scy;&ocy;&kcy;&rcy;&acy;&shchcy;&iecy;&ncy;&icy;&iecy;&mcy; &tcy;&acy;&kcy;&icy;&khcy; 40 &dcy;&lcy;&icy;&ncy;&ncy;&ycy;&khcy; &scy;&tcy;&rcy;&ocy;&kcy;  char . &Acy;&bcy;&bcy;&rcy;&iecy;&vcy;&icy;&acy;&tcy;&ucy;&rcy;&ycy; &mcy;&ocy;&zhcy;&ncy;&ocy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy; &vcy;&iecy;&zcy;&dcy;&iecy;, &gcy;&dcy;&iecy; &mcy;&ocy;&gcy;&ucy;&tcy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy;&scy;&yacy; 40 &acy;&kcy;&tcy;&iecy;&rcy;&scy;&kcy;&icy;&khcy; &scy;&tcy;&rcy;&ocy;&kcy;  char , &pcy;&rcy;&icy; &ucy;&scy;&lcy;&ocy;&vcy;&icy;&icy;, &chcy;&tcy;&ocy; &ocy;&ncy;&icy; &ocy;&dcy;&ncy;&ocy;&zcy;&ncy;&acy;&chcy;&ncy;&ycy;.</span></p> <p><span data-i18n="6f2d876f4a5a2e114a820b4b81bfee7b23832172f68de9df94c2c551e36ef564/47" data-source="It is expected that the content of the commit object you created while following the example above generates a different SHA-1 hash than the one shown above because the commit object records the time when it was created and the name of the person performing the commit." onmousemove="i18n(this)">&Ocy;&zhcy;&icy;&dcy;&acy;&iecy;&tcy;&scy;&yacy;, &chcy;&tcy;&ocy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ocy;&iecy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&acy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;, &scy;&ocy;&zcy;&dcy;&acy;&ncy;&ncy;&ocy;&gcy;&ocy; &vcy;&acy;&mcy;&icy; &vcy; &scy;&ocy;&ocy;&tcy;&vcy;&iecy;&tcy;&scy;&tcy;&vcy;&icy;&icy; &scy; &pcy;&rcy;&icy;&vcy;&iecy;&dcy;&iecy;&ncy;&ncy;&ycy;&mcy; &vcy;&ycy;&shcy;&iecy; &pcy;&rcy;&icy;&mcy;&iecy;&rcy;&ocy;&mcy;, &gcy;&iecy;&ncy;&iecy;&rcy;&icy;&rcy;&ucy;&iecy;&tcy; &khcy;&ecy;&shcy; SHA-1, &ocy;&tcy;&lcy;&icy;&chcy;&ncy;&ycy;&jcy; &ocy;&tcy; &pcy;&ocy;&kcy;&acy;&zcy;&acy;&ncy;&ncy;&ocy;&gcy;&ocy; &vcy;&ycy;&shcy;&iecy;, &pcy;&ocy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ucy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy; &zcy;&acy;&pcy;&icy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &vcy;&rcy;&iecy;&mcy;&yacy; &iecy;&gcy;&ocy; &scy;&ocy;&zcy;&dcy;&acy;&ncy;&icy;&yacy; &icy; &icy;&mcy;&yacy; &chcy;&iecy;&lcy;&ocy;&vcy;&iecy;&kcy;&acy;, &vcy;&ycy;&pcy;&ocy;&lcy;&ncy;&icy;&vcy;&shcy;&iecy;&gcy;&ocy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy;.</span></p> <p><span data-i18n="d78d68e8248aa6169b7773095501820b2be80c8a4516ccaf777519803478ecf2/ed" data-source="We can ask Git about this particular object with the &lt;code&gt;cat-file&lt;/code&gt; command. Don&amp;rsquo;t copy the 40 hex digits from this example but use those from your own version. Note that you can shorten it to only a few characters to save yourself typing all 40 hex digits:" onmousemove="i18n(this)">&Mcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&mcy; &scy;&pcy;&rcy;&ocy;&scy;&icy;&tcy;&softcy;  Git  &ocy;&bcy; &ecy;&tcy;&ocy;&mcy; &kcy;&ocy;&ncy;&kcy;&rcy;&iecy;&tcy;&ncy;&ocy;&mcy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&iecy; &scy; &pcy;&ocy;&mcy;&ocy;&shchcy;&softcy;&yucy; &kcy;&ocy;&mcy;&acy;&ncy;&dcy;&ycy;  <code>cat-file</code> . &Ncy;&iecy; &kcy;&ocy;&pcy;&icy;&rcy;&ucy;&jcy;&tcy;&iecy; 40 &shcy;&iecy;&scy;&tcy;&ncy;&acy;&dcy;&tscy;&acy;&tcy;&iecy;&rcy;&icy;&chcy;&ncy;&ycy;&khcy; &tscy;&icy;&fcy;&rcy; &icy;&zcy; &ecy;&tcy;&ocy;&gcy;&ocy; &pcy;&rcy;&icy;&mcy;&iecy;&rcy;&acy;, &acy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&jcy;&tcy;&iecy; &icy;&khcy; &icy;&zcy; &scy;&vcy;&ocy;&iecy;&jcy; &vcy;&iecy;&rcy;&scy;&icy;&icy;. &Ocy;&bcy;&rcy;&acy;&tcy;&icy;&tcy;&iecy; &vcy;&ncy;&icy;&mcy;&acy;&ncy;&icy;&iecy;, &chcy;&tcy;&ocy; &vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &scy;&ocy;&kcy;&rcy;&acy;&tcy;&icy;&tcy;&softcy; &iecy;&gcy;&ocy; &dcy;&ocy; &ncy;&iecy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&icy;&khcy; &scy;&icy;&mcy;&vcy;&ocy;&lcy;&ocy;&vcy;, &chcy;&tcy;&ocy;&bcy;&ycy; &ncy;&iecy; &vcy;&vcy;&ocy;&dcy;&icy;&tcy;&softcy; &vcy;&scy;&iecy; 40 &shcy;&iecy;&scy;&tcy;&ncy;&acy;&dcy;&tscy;&acy;&tcy;&iecy;&rcy;&icy;&chcy;&ncy;&ycy;&khcy; &tscy;&icy;&fcy;&rcy;:</span></p> <div> <div> <pre class="hljs language-sql">$ git cat<span class="hljs-operator">-</span>file <span class="hljs-operator">-</span>t <span class="hljs-number">54196</span>cc2
<span class="hljs-keyword">commit</span>
$ git cat<span class="hljs-operator">-</span>file <span class="hljs-keyword">commit</span> <span class="hljs-number">54196</span>cc2
tree <span class="hljs-number">92</span>b8b694ffb1675e5975148e1121810081dbdffe
author J. Bruce Fields <span class="hljs-operator">&lt;</span>bfields<span class="hljs-variable">@puzzle</span>.fieldses.org<span class="hljs-operator">&gt;</span> <span class="hljs-number">1143414668</span> <span class="hljs-number">-0500</span>
committer J. Bruce Fields <span class="hljs-operator">&lt;</span>bfields<span class="hljs-variable">@puzzle</span>.fieldses.org<span class="hljs-operator">&gt;</span> <span class="hljs-number">1143414668</span> <span class="hljs-number">-0500</span>

<span class="hljs-keyword">initial</span> <span class="hljs-keyword">commit</span></pre> </div> </div> <p><span data-i18n="f3007a248e1d40f35e4249a3e67771fc0329c210f4f3cc6f3722814a502c0f15/e9" data-source="A tree can refer to one or more &amp;quot;blob&amp;quot; objects, each corresponding to a file. In addition, a tree can also refer to other tree objects, thus creating a directory hierarchy. You can examine the contents of any tree using ls-tree (remember that a long enough initial portion of the SHA-1 will also work):" onmousemove="i18n(this)">&Dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &mcy;&ocy;&zhcy;&iecy;&tcy; &scy;&scy;&ycy;&lcy;&acy;&tcy;&softcy;&scy;&yacy; &ncy;&acy; &ocy;&dcy;&icy;&ncy; &icy;&lcy;&icy; &ncy;&iecy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ocy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ocy;&vcy;  &quot;blob&quot; , &kcy;&acy;&zhcy;&dcy;&ycy;&jcy; &icy;&zcy; &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&khcy; &scy;&ocy;&ocy;&tcy;&vcy;&iecy;&tcy;&scy;&tcy;&vcy;&ucy;&iecy;&tcy; &fcy;&acy;&jcy;&lcy;&ucy;. &Kcy;&rcy;&ocy;&mcy;&iecy; &tcy;&ocy;&gcy;&ocy;, &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &mcy;&ocy;&zhcy;&iecy;&tcy; &tcy;&acy;&kcy;&zhcy;&iecy; &scy;&scy;&ycy;&lcy;&acy;&tcy;&softcy;&scy;&yacy; &ncy;&acy; &dcy;&rcy;&ucy;&gcy;&icy;&iecy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ycy; &dcy;&iecy;&rcy;&iecy;&vcy;&acy;, &scy;&ocy;&zcy;&dcy;&acy;&vcy;&acy;&yacy; &tcy;&acy;&kcy;&icy;&mcy; &ocy;&bcy;&rcy;&acy;&zcy;&ocy;&mcy; &icy;&iecy;&rcy;&acy;&rcy;&khcy;&icy;&yucy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&ocy;&vcy;. &Vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &pcy;&rcy;&ocy;&scy;&mcy;&ocy;&tcy;&rcy;&iecy;&tcy;&softcy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ocy;&iecy; &lcy;&yucy;&bcy;&ocy;&gcy;&ocy; &dcy;&iecy;&rcy;&iecy;&vcy;&acy; &scy; &pcy;&ocy;&mcy;&ocy;&shchcy;&softcy;&yucy; ls-tree (&pcy;&ocy;&mcy;&ncy;&icy;&tcy;&iecy;, &chcy;&tcy;&ocy; &dcy;&ocy;&scy;&tcy;&acy;&tcy;&ocy;&chcy;&ncy;&ocy; &dcy;&lcy;&icy;&ncy;&ncy;&acy;&yacy; &ncy;&acy;&chcy;&acy;&lcy;&softcy;&ncy;&acy;&yacy; &chcy;&acy;&scy;&tcy;&softcy; SHA-1 &tcy;&acy;&kcy;&zhcy;&iecy; &pcy;&ocy;&dcy;&ocy;&jcy;&dcy;&iecy;&tcy;):</span></p> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git ls-tree 92b8b694
<span class="hljs-number">100644</span> blob 3b18e512dba79e4c8300dd08aeb37f8e728b8dad    file.txt</pre> </div> </div> <p><span data-i18n="6ff4938b87e0fbb32a75f5c7364d29cc8d078c539b8e19c255879d4fc74760ad/58" data-source="Thus we see that this tree has one file in it. The SHA-1 hash is a reference to that file&amp;rsquo;s data:" onmousemove="i18n(this)">&Tcy;&acy;&kcy;&icy;&mcy; &ocy;&bcy;&rcy;&acy;&zcy;&ocy;&mcy;, &mcy;&ycy; &vcy;&icy;&dcy;&icy;&mcy;, &chcy;&tcy;&ocy; &vcy; &ecy;&tcy;&ocy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy; &iecy;&scy;&tcy;&softcy; &ocy;&dcy;&icy;&ncy; &fcy;&acy;&jcy;&lcy;. &KHcy;&ecy;&shcy; SHA-1 &yacy;&vcy;&lcy;&yacy;&iecy;&tcy;&scy;&yacy; &scy;&scy;&ycy;&lcy;&kcy;&ocy;&jcy; &ncy;&acy; &dcy;&acy;&ncy;&ncy;&ycy;&iecy; &ecy;&tcy;&ocy;&gcy;&ocy; &fcy;&acy;&jcy;&lcy;&acy;:</span></p> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git cat-file -t 3b18e512
blob</pre> </div> </div> <p><span data-i18n="e55257e472707c1a11f3e8082a4f55c83a10686c3295baa4747d55849a3762d5/8d" data-source="A &amp;quot;blob&amp;quot; is just file data, which we can also examine with cat-file:" onmousemove="i18n(this)">&quot;blob&quot;  &mdash; &ecy;&tcy;&ocy; &pcy;&rcy;&ocy;&scy;&tcy;&ocy; &dcy;&acy;&ncy;&ncy;&ycy;&iecy; &fcy;&acy;&jcy;&lcy;&acy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &mcy;&ycy; &tcy;&acy;&kcy;&zhcy;&iecy; &mcy;&ocy;&zhcy;&iecy;&mcy; &pcy;&rcy;&ocy;&scy;&mcy;&ocy;&tcy;&rcy;&iecy;&tcy;&softcy; &scy; &pcy;&ocy;&mcy;&ocy;&shchcy;&softcy;&yucy; cat-&fcy;&acy;&jcy;&lcy;&acy;:</span></p> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git cat-file blob 3b18e512
hello world</pre> </div> </div> <p><span data-i18n="46eafa39731a49be42902c928d273bb64a0cef900c2d47a8ba008515f58f8097/f5" data-source="Note that this is the old file data; so the object that Git named in its response to the initial tree was a tree with a snapshot of the directory state that was recorded by the first commit." onmousemove="i18n(this)">&Ocy;&bcy;&rcy;&acy;&tcy;&icy;&tcy;&iecy; &vcy;&ncy;&icy;&mcy;&acy;&ncy;&icy;&iecy;, &chcy;&tcy;&ocy; &ecy;&tcy;&ocy; &scy;&tcy;&acy;&rcy;&ycy;&iecy; &dcy;&acy;&ncy;&ncy;&ycy;&iecy; &fcy;&acy;&jcy;&lcy;&acy;; &pcy;&ocy;&ecy;&tcy;&ocy;&mcy;&ucy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy;  Git  &ncy;&acy;&zcy;&vcy;&acy;&lcy; &vcy; &scy;&vcy;&ocy;&iecy;&mcy; &ocy;&tcy;&vcy;&iecy;&tcy;&iecy; &ncy;&acy; &icy;&scy;&khcy;&ocy;&dcy;&ncy;&ocy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;, &bcy;&ycy;&lcy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;&mcy; &scy;&ocy; &scy;&ncy;&icy;&mcy;&kcy;&ocy;&mcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&yacy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&acy;, &zcy;&acy;&pcy;&icy;&scy;&acy;&ncy;&ncy;&ycy;&mcy; &pcy;&rcy;&icy; &pcy;&iecy;&rcy;&vcy;&ocy;&mcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&iecy;.</span></p> <p><span data-i18n="d00ec8a4a9de50cfb0a1935048a821c1150b9aa165df39f100c37b3fb9271070/e5" data-source="All of these objects are stored under their SHA-1 names inside the Git directory:" onmousemove="i18n(this)">&Vcy;&scy;&iecy; &ecy;&tcy;&icy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ycy; &khcy;&rcy;&acy;&ncy;&yacy;&tcy;&scy;&yacy; &pcy;&ocy;&dcy; &scy;&vcy;&ocy;&icy;&mcy;&icy; &icy;&mcy;&iecy;&ncy;&acy;&mcy;&icy; SHA-1 &vcy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&iecy;  Git :</span></p> <div> <div> <pre class="hljs language-bash">$ find .git/objects/
.git/objects/
.git/objects/pack
.git/objects/info
.git/objects/3b
.git/objects/3b/18e512dba79e4c8300dd08aeb37f8e728b8dad
.git/objects/92
.git/objects/92/b8b694ffb1675e5975148e1121810081dbdffe
.git/objects/54
.git/objects/54/196cc2703dc165cbd373a65a4dcf22d50ae7f7
.git/objects/a0
.git/objects/a0/423896973644771497bdc03eb99d5281615b51
.git/objects/d0
.git/objects/d0/492b368b66bdabf2ac1fd8c92b39d3db916e59
.git/objects/c4
.git/objects/c4/d59f390b9cfd4318117afde11d601c1085f241</pre> </div> </div> <p><span data-i18n="d093d62c533d61bb82dc1790b36c1a7d15c6a7f24859b2fc0ac0fe181c6b2b94/e6" data-source="and the contents of these files is just the compressed data plus a header identifying their length and their type. The type is either a blob, a tree, a commit, or a tag." onmousemove="i18n(this)">&icy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ocy;&iecy; &ecy;&tcy;&icy;&khcy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy; &mdash; &ecy;&tcy;&ocy; &pcy;&rcy;&ocy;&scy;&tcy;&ocy; &scy;&zhcy;&acy;&tcy;&ycy;&iecy; &dcy;&acy;&ncy;&ncy;&ycy;&iecy; &pcy;&lcy;&yucy;&scy; &zcy;&acy;&gcy;&ocy;&lcy;&ocy;&vcy;&ocy;&kcy;, &ocy;&pcy;&rcy;&iecy;&dcy;&iecy;&lcy;&yacy;&yucy;&shchcy;&icy;&jcy; &icy;&khcy; &dcy;&lcy;&icy;&ncy;&ucy; &icy; &tcy;&icy;&pcy;. &Tcy;&icy;&pcy;&ocy;&mcy; &mcy;&ocy;&zhcy;&iecy;&tcy; &bcy;&ycy;&tcy;&softcy; &bcy;&ocy;&lcy;&softcy;&shcy;&ocy;&jcy; &dcy;&vcy;&ocy;&icy;&chcy;&ncy;&ycy;&jcy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;, &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;, &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yacy; &icy;&lcy;&icy; &tcy;&iecy;&gcy;.</span></p> <p><span data-i18n="0b9997d31ab2a89244160809d3c3b5b515800df34eb3138a572975795292b5bb/f2" data-source="The simplest commit to find is the HEAD commit, which we can find from .git/HEAD:" onmousemove="i18n(this)">&Scy;&acy;&mcy;&ycy;&jcy; &pcy;&rcy;&ocy;&scy;&tcy;&ocy;&jcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &mcy;&ocy;&zhcy;&ncy;&ocy; &ncy;&acy;&jcy;&tcy;&icy;, &mdash; &ecy;&tcy;&ocy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy; HEAD, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &mcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&mcy; &ncy;&acy;&jcy;&tcy;&icy; &vcy; .git/HEAD:</span></p> <div> <div> <pre class="hljs language-bash">$ <span class="hljs-built_in">cat</span> .git/HEAD
ref: refs/heads/master</pre> </div> </div> <p><span data-i18n="0927560f7905dcacaef871b60b927dd9359e1ec635af47d3e4abe579b01d70c2/dc" data-source="As you can see, this tells us which branch we&amp;rsquo;re currently on, and it tells us this by naming a file under the .git directory, which itself contains a SHA-1 name referring to a commit object, which we can examine with cat-file:" onmousemove="i18n(this)">&Kcy;&acy;&kcy; &vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &vcy;&icy;&dcy;&iecy;&tcy;&softcy;, &ecy;&tcy;&ocy; &scy;&ocy;&ocy;&bcy;&shchcy;&acy;&iecy;&tcy; &ncy;&acy;&mcy;, &vcy; &kcy;&acy;&kcy;&ocy;&jcy; &vcy;&iecy;&tcy;&kcy;&iecy; &mcy;&ycy; &scy;&iecy;&jcy;&chcy;&acy;&scy; &ncy;&acy;&khcy;&ocy;&dcy;&icy;&mcy;&scy;&yacy;, &icy; &scy;&ocy;&ocy;&bcy;&shchcy;&acy;&iecy;&tcy; &ncy;&acy;&mcy; &ocy;&bcy; &ecy;&tcy;&ocy;&mcy;, &ncy;&acy;&zcy;&ycy;&vcy;&acy;&yacy; &fcy;&acy;&jcy;&lcy; &vcy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&iecy; .git, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &scy;&acy;&mcy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&tcy; &icy;&mcy;&yacy; SHA-1, &scy;&scy;&ycy;&lcy;&acy;&yucy;&shchcy;&iecy;&iecy;&scy;&yacy; &ncy;&acy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &mcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&mcy; &pcy;&rcy;&ocy;&vcy;&iecy;&rcy;&icy;&tcy;&softcy; &scy; &pcy;&ocy;&mcy;&ocy;&shchcy;&softcy;&yucy; &kcy;&ocy;&shcy;&acy;&chcy;&icy;&jcy;-&fcy;&acy;&jcy;&lcy;:</span></p> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>cat .git/refs/heads/master
c4d59f390b9cfd4318117afde11d601c1085f241
<span class="hljs-variable">$ </span>git cat-file -t c4d59f39
commit
<span class="hljs-variable">$ </span>git cat-file commit c4d59f39
tree d0492b368b66bdabf2ac1fd8c92b39d3db916e59
parent 54196cc2703dc165cbd373a65a4dcf22d50ae7f7
author J. <span class="hljs-title class_">Bruce</span> <span class="hljs-title class_">Fields</span> &lt;bfields<span class="hljs-variable">@puzzle</span>.fieldses.org&gt; <span class="hljs-number">1143418702</span> -<span class="hljs-number">0500</span>
committer J. <span class="hljs-title class_">Bruce</span> <span class="hljs-title class_">Fields</span> &lt;bfields<span class="hljs-variable">@puzzle</span>.fieldses.org&gt; <span class="hljs-number">1143418702</span> -<span class="hljs-number">0500</span>

add emphasis</pre> </div> </div> <p><span data-i18n="64d9c4252e8f61d49cfa687395f7ec016540829b046ad60fc24504c8a572f9cc/55" data-source="The &amp;quot;tree&amp;quot; object here refers to the new state of the tree:" onmousemove="i18n(this)">&Ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;  &quot;tree&quot;  &zcy;&dcy;&iecy;&scy;&softcy; &ocy;&tcy;&ncy;&ocy;&scy;&icy;&tcy;&scy;&yacy; &kcy; &ncy;&ocy;&vcy;&ocy;&mcy;&ucy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&yucy; &dcy;&iecy;&rcy;&iecy;&vcy;&acy;:</span></p> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git ls-tree d0492b36
<span class="hljs-number">100644</span> blob a0423896973644771497bdc03eb99d5281615b51    file.txt
<span class="hljs-variable">$ </span>git cat-file blob a0423896
hello world!</pre> </div> </div> <p><span data-i18n="facf0175037da96f8444b34d498319e57234b11106ee09bec062a57891fde877/43" data-source="and the &amp;quot;parent&amp;quot; object refers to the previous commit:" onmousemove="i18n(this)">&acy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;  &quot;parent&quot;  &scy;&scy;&ycy;&lcy;&acy;&iecy;&tcy;&scy;&yacy; &ncy;&acy; &pcy;&rcy;&iecy;&dcy;&ycy;&dcy;&ucy;&shchcy;&icy;&jcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;:</span></p> <div> <div> <pre class="hljs language-sql">$ git cat<span class="hljs-operator">-</span>file <span class="hljs-keyword">commit</span> <span class="hljs-number">54196</span>cc2
tree <span class="hljs-number">92</span>b8b694ffb1675e5975148e1121810081dbdffe
author J. Bruce Fields <span class="hljs-operator">&lt;</span>bfields<span class="hljs-variable">@puzzle</span>.fieldses.org<span class="hljs-operator">&gt;</span> <span class="hljs-number">1143414668</span> <span class="hljs-number">-0500</span>
committer J. Bruce Fields <span class="hljs-operator">&lt;</span>bfields<span class="hljs-variable">@puzzle</span>.fieldses.org<span class="hljs-operator">&gt;</span> <span class="hljs-number">1143414668</span> <span class="hljs-number">-0500</span>

<span class="hljs-keyword">initial</span> <span class="hljs-keyword">commit</span></pre> </div> </div> <p><span data-i18n="74447d6f59260b10de14446450bc962c99af943dbc087c677c375f9a79af4209/ef" data-source="The tree object is the tree we examined first, and this commit is unusual in that it lacks any parent." onmousemove="i18n(this)">&Ocy;&bcy;&hardcy;&iecy;&kcy;&tcy; &dcy;&iecy;&rcy;&iecy;&vcy;&acy; &mdash; &ecy;&tcy;&ocy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ocy;&iecy; &mcy;&ycy; &icy;&scy;&scy;&lcy;&iecy;&dcy;&ocy;&vcy;&acy;&lcy;&icy; &pcy;&iecy;&rcy;&vcy;&ycy;&mcy;, &icy; &ecy;&tcy;&ocy;&tcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy; &ncy;&iecy;&ocy;&bcy;&ycy;&chcy;&iecy;&ncy; &tcy;&iecy;&mcy;, &chcy;&tcy;&ocy; &ucy; &ncy;&iecy;&gcy;&ocy; &ncy;&iecy;&tcy; &rcy;&ocy;&dcy;&icy;&tcy;&iecy;&lcy;&yacy;.</span></p> <p><span data-i18n="7a018834c777840324bf077e5f4fc50184de3ef7ec073ca5a2edac6b5a190b6b/b7" data-source="Most commits have only one parent, but it is also common for a commit to have multiple parents. In that case the commit represents a merge, with the parent references pointing to the heads of the merged branches." onmousemove="i18n(this)">&Bcy;&ocy;&lcy;&softcy;&shcy;&icy;&ncy;&scy;&tcy;&vcy;&ocy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&vcy; &icy;&mcy;&iecy;&yucy;&tcy; &tcy;&ocy;&lcy;&softcy;&kcy;&ocy; &ocy;&dcy;&ncy;&ocy;&gcy;&ocy; &rcy;&ocy;&dcy;&icy;&tcy;&iecy;&lcy;&yacy;, &ncy;&ocy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy; &tcy;&acy;&kcy;&zhcy;&iecy; &mcy;&ocy;&zhcy;&iecy;&tcy; &icy;&mcy;&iecy;&tcy;&softcy; &ncy;&iecy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ocy; &rcy;&ocy;&dcy;&icy;&tcy;&iecy;&lcy;&iecy;&jcy;. &Vcy; &ecy;&tcy;&ocy;&mcy; &scy;&lcy;&ucy;&chcy;&acy;&iecy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yacy; &pcy;&rcy;&iecy;&dcy;&scy;&tcy;&acy;&vcy;&lcy;&yacy;&iecy;&tcy; &scy;&ocy;&bcy;&ocy;&jcy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&iecy;, &pcy;&rcy;&icy; &ecy;&tcy;&ocy;&mcy; &rcy;&ocy;&dcy;&icy;&tcy;&iecy;&lcy;&softcy;&scy;&kcy;&icy;&iecy; &scy;&scy;&ycy;&lcy;&kcy;&icy; &ucy;&kcy;&acy;&zcy;&ycy;&vcy;&acy;&yucy;&tcy; &ncy;&acy; &zcy;&acy;&gcy;&ocy;&lcy;&ocy;&vcy;&kcy;&icy; &ocy;&bcy;&hardcy;&iecy;&dcy;&icy;&ncy;&iecy;&ncy;&ncy;&ycy;&khcy; &vcy;&iecy;&tcy;&vcy;&iecy;&jcy;.</span></p> <p><span data-i18n="82a94c93433a213b6da2fa2551ee4222c88ecd443f9a604da4c7f9957bca7428/2c" data-source="Besides blobs, trees, and commits, the only remaining type of object is a &amp;quot;tag&amp;quot;, which we won&amp;rsquo;t discuss here; refer to &lt;a href=&quot;git-tag&quot;&gt;git-tag[1]&lt;/a&gt; for details." onmousemove="i18n(this)">&Pcy;&ocy;&mcy;&icy;&mcy;&ocy; &bcy;&ocy;&lcy;&softcy;&shcy;&icy;&khcy; &dcy;&vcy;&ocy;&icy;&chcy;&ncy;&ycy;&khcy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ocy;&vcy;, &dcy;&iecy;&rcy;&iecy;&vcy;&softcy;&iecy;&vcy; &icy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&vcy;, &iecy;&dcy;&icy;&ncy;&scy;&tcy;&vcy;&iecy;&ncy;&ncy;&ycy;&mcy; &ocy;&scy;&tcy;&acy;&vcy;&shcy;&icy;&mcy;&scy;&yacy; &tcy;&icy;&pcy;&ocy;&mcy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ocy;&vcy; &yacy;&vcy;&lcy;&yacy;&iecy;&tcy;&scy;&yacy;  &quot;tag&quot; , &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &mcy;&ycy; &zcy;&dcy;&iecy;&scy;&softcy; &ocy;&bcy;&scy;&ucy;&zhcy;&dcy;&acy;&tcy;&softcy; &ncy;&iecy; &bcy;&ucy;&dcy;&iecy;&mcy;; &pcy;&ocy;&dcy;&rcy;&ocy;&bcy;&ncy;&ocy;&scy;&tcy;&icy; &scy;&mcy;. &vcy;  <a href="git-tag.html">git-tag[1]</a> .</span></p> <p><span data-i18n="6aab0ca876095b7f136db3dc2df10ba56978d4897d375ef7967c337a30145374/cf" data-source="So now we know how Git uses the object database to represent a project&amp;rsquo;s history:" onmousemove="i18n(this)">&Icy;&tcy;&acy;&kcy;, &tcy;&iecy;&pcy;&iecy;&rcy;&softcy; &mcy;&ycy; &zcy;&ncy;&acy;&iecy;&mcy;, &kcy;&acy;&kcy;  Git  &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&iecy;&tcy; &bcy;&acy;&zcy;&ucy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ocy;&vcy; &dcy;&lcy;&yacy; &pcy;&rcy;&iecy;&dcy;&scy;&tcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&yacy; &icy;&scy;&tcy;&ocy;&rcy;&icy;&icy; &pcy;&rcy;&ocy;&iecy;&kcy;&tcy;&acy;:</span></p> <div> <ul> <li> <p><span data-i18n="d0fe59369f9f61ceb171a4e20e45f544bc0501dfebd1a748818b5b4097209f12/e9" data-source="&amp;quot;commit&amp;quot; objects refer to &amp;quot;tree&amp;quot; objects representing the snapshot of a directory tree at a particular point in the history, and refer to &amp;quot;parent&amp;quot; commits to show how they&amp;rsquo;re connected into the project history." onmousemove="i18n(this)">&Ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ycy;  &quot;commit&quot;  &scy;&scy;&ycy;&lcy;&acy;&yucy;&tcy;&scy;&yacy; &ncy;&acy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ycy;  &quot;tree&quot; , &pcy;&rcy;&iecy;&dcy;&scy;&tcy;&acy;&vcy;&lcy;&yacy;&yucy;&shchcy;&icy;&iecy; &scy;&ncy;&icy;&mcy;&ocy;&kcy; &dcy;&iecy;&rcy;&iecy;&vcy;&acy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&ocy;&vcy; &vcy; &ocy;&pcy;&rcy;&iecy;&dcy;&iecy;&lcy;&iecy;&ncy;&ncy;&ycy;&jcy; &mcy;&ocy;&mcy;&iecy;&ncy;&tcy; &icy;&scy;&tcy;&ocy;&rcy;&icy;&icy;, &icy; &scy;&scy;&ycy;&lcy;&acy;&yucy;&tcy;&scy;&yacy; &ncy;&acy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;  &quot;parent&quot; , &chcy;&tcy;&ocy;&bcy;&ycy; &pcy;&ocy;&kcy;&acy;&zcy;&acy;&tcy;&softcy;, &kcy;&acy;&kcy; &ocy;&ncy;&icy; &scy;&vcy;&yacy;&zcy;&acy;&ncy;&ycy; &scy; &icy;&scy;&tcy;&ocy;&rcy;&icy;&iecy;&jcy; &pcy;&rcy;&ocy;&iecy;&kcy;&tcy;&acy;.</span></p> </li> <li> <p><span data-i18n="4a441d2f6b6c5d11962e7d4cd9a8ce40bb9bd5c6dd734cb03fab28e9374239c6/3c" data-source="&amp;quot;tree&amp;quot; objects represent the state of a single directory, associating directory names to &amp;quot;blob&amp;quot; objects containing file data and &amp;quot;tree&amp;quot; objects containing subdirectory information." onmousemove="i18n(this)">&Ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ycy;  &quot;tree&quot;  &pcy;&rcy;&iecy;&dcy;&scy;&tcy;&acy;&vcy;&lcy;&yacy;&yucy;&tcy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&iecy; &ocy;&dcy;&ncy;&ocy;&gcy;&ocy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&acy;, &scy;&vcy;&yacy;&zcy;&ycy;&vcy;&acy;&yacy; &icy;&mcy;&iecy;&ncy;&acy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&ocy;&vcy; &scy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&acy;&mcy;&icy;  &quot;blob&quot; , &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&acy;&shchcy;&icy;&mcy;&icy; &dcy;&acy;&ncy;&ncy;&ycy;&iecy; &fcy;&acy;&jcy;&lcy;&acy;, &icy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&acy;&mcy;&icy;  &quot;tree&quot; , &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&acy;&shchcy;&icy;&mcy;&icy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&yucy; &ocy; &pcy;&ocy;&dcy;&kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&acy;&khcy;.</span></p> </li> <li> <p><span data-i18n="d6808d0f6fa979c86b0fcdc5ed357f9b43c0cd11e0daa4f4a181a4bc475a8273/9e" data-source="&amp;quot;blob&amp;quot; objects contain file data without any other structure." onmousemove="i18n(this)">&Ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ycy;  &quot;blob&quot;  &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&acy;&tcy; &dcy;&acy;&ncy;&ncy;&ycy;&iecy; &fcy;&acy;&jcy;&lcy;&acy; &bcy;&iecy;&zcy; &kcy;&acy;&kcy;&ocy;&jcy;-&lcy;&icy;&bcy;&ocy; &dcy;&rcy;&ucy;&gcy;&ocy;&jcy; &scy;&tcy;&rcy;&ucy;&kcy;&tcy;&ucy;&rcy;&ycy;.</span></p> </li> <li> <p><span data-i18n="37c078154f5584923f159ba82811e8f31ec9dd1811ff8b4b5e3e258e0d2918f3/85" data-source="References to commit objects at the head of each branch are stored in files under .git/refs/heads/." onmousemove="i18n(this)">&Scy;&scy;&ycy;&lcy;&kcy;&icy; &ncy;&acy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ycy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy; &vcy; &ncy;&acy;&chcy;&acy;&lcy;&iecy; &kcy;&acy;&zhcy;&dcy;&ocy;&jcy; &vcy;&iecy;&tcy;&kcy;&icy; &khcy;&rcy;&acy;&ncy;&yacy;&tcy;&scy;&yacy; &vcy; &fcy;&acy;&jcy;&lcy;&acy;&khcy; .git/refs/heads/.</span></p> </li> <li> <p><span data-i18n="22ca9f645148a28fbbbe2fc6263da798cf70b7a4a0e3bf195ac4e996716569dd/fc" data-source="The name of the current branch is stored in .git/HEAD." onmousemove="i18n(this)">&Icy;&mcy;&yacy; &tcy;&iecy;&kcy;&ucy;&shchcy;&iecy;&jcy; &vcy;&iecy;&tcy;&kcy;&icy; &khcy;&rcy;&acy;&ncy;&icy;&tcy;&scy;&yacy; &vcy; .git/HEAD.</span></p> </li> </ul> </div> <p><span data-i18n="90887edc0fd5a0088672a80339da55d20742ba8fedac1879efffada0e385687a/23" data-source="Note, by the way, that lots of commands take a tree as an argument. But as we can see above, a tree can be referred to in many different ways&amp;mdash;&amp;ZeroWidthSpace;by the SHA-1 name for that tree, by the name of a commit that refers to the tree, by the name of a branch whose head refers to that tree, etc.--and most such commands can accept any of these names." onmousemove="i18n(this)">&Kcy;&scy;&tcy;&acy;&tcy;&icy;, &ocy;&bcy;&rcy;&acy;&tcy;&icy;&tcy;&iecy; &vcy;&ncy;&icy;&mcy;&acy;&ncy;&icy;&iecy;, &chcy;&tcy;&ocy; &mcy;&ncy;&ocy;&gcy;&icy;&iecy; &kcy;&ocy;&mcy;&acy;&ncy;&dcy;&ycy; &pcy;&rcy;&icy;&ncy;&icy;&mcy;&acy;&yucy;&tcy; &vcy; &kcy;&acy;&chcy;&iecy;&scy;&tcy;&vcy;&iecy; &acy;&rcy;&gcy;&ucy;&mcy;&iecy;&ncy;&tcy;&acy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;. &Ncy;&ocy;, &kcy;&acy;&kcy; &mcy;&ycy; &vcy;&icy;&dcy;&icy;&mcy; &vcy;&ycy;&shcy;&iecy;, &ncy;&acy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy; &mcy;&ocy;&zhcy;&ncy;&ocy; &scy;&scy;&ycy;&lcy;&acy;&tcy;&softcy;&scy;&yacy; &pcy;&ocy;-&rcy;&acy;&zcy;&ncy;&ocy;&mcy;&ucy;: &pcy;&ocy; &icy;&mcy;&iecy;&ncy;&icy; SHA-1 &ecy;&tcy;&ocy;&gcy;&ocy; &dcy;&iecy;&rcy;&iecy;&vcy;&acy;, &pcy;&ocy; &icy;&mcy;&iecy;&ncy;&icy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&acy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &scy;&scy;&ycy;&lcy;&acy;&iecy;&tcy;&scy;&yacy; &ncy;&acy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;, &pcy;&ocy; &icy;&mcy;&iecy;&ncy;&icy; &vcy;&iecy;&tcy;&kcy;&icy;, &zcy;&acy;&gcy;&ocy;&lcy;&ocy;&vcy;&ocy;&kcy; &kcy;&ocy;&tcy;&ocy;&rcy;&ocy;&jcy; &scy;&scy;&ycy;&lcy;&acy;&iecy;&tcy;&scy;&yacy; &ncy;&acy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;. &kcy; &ecy;&tcy;&ocy;&mcy;&ucy; &dcy;&iecy;&rcy;&iecy;&vcy;&ucy; &icy; &tcy;. &dcy;. &mdash; &icy; &bcy;&ocy;&lcy;&softcy;&shcy;&icy;&ncy;&scy;&tcy;&vcy;&ocy; &tcy;&acy;&kcy;&icy;&khcy; &kcy;&ocy;&mcy;&acy;&ncy;&dcy; &mcy;&ocy;&gcy;&ucy;&tcy; &pcy;&rcy;&icy;&ncy;&icy;&mcy;&acy;&tcy;&softcy; &lcy;&yucy;&bcy;&ocy;&iecy; &icy;&zcy; &ecy;&tcy;&icy;&khcy; &icy;&mcy;&iecy;&ncy;.</span></p> <p><span data-i18n="982ecaa0dc53eb19e12bfea928af679be246ade6a8a5fb310e4a076dc978296a/b4" data-source="In command synopses, the word &amp;quot;tree-ish&amp;quot; is sometimes used to designate such an argument." onmousemove="i18n(this)">&Vcy; &ocy;&pcy;&icy;&scy;&acy;&ncy;&icy;&yacy;&khcy; &kcy;&ocy;&mcy;&acy;&ncy;&dcy; &dcy;&lcy;&yacy; &ocy;&bcy;&ocy;&zcy;&ncy;&acy;&chcy;&iecy;&ncy;&icy;&yacy; &tcy;&acy;&kcy;&ocy;&gcy;&ocy; &acy;&rcy;&gcy;&ucy;&mcy;&iecy;&ncy;&tcy;&acy; &icy;&ncy;&ocy;&gcy;&dcy;&acy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&iecy;&tcy;&scy;&yacy; &scy;&lcy;&ocy;&vcy;&ocy;  &quot;tree-ish&quot; .</span></p> </div> <h2 class="text-body-emphasis"  id="_the_index_file"><span data-i18n="9ea0a531a4904fee7bdc9d9cdd001f1e38f6b9fd30572b1c776bd73d167667d0/51" data-source="The index file" onmousemove="i18n(this)">&Icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ycy;&jcy; &fcy;&acy;&jcy;&lcy;</span></h2> <div> <p><span data-i18n="ad0046ee7671bf8f8012d91e1c45c7f0af0f9f71dc51344ae79de7af33eb3991/b5" data-source="The primary tool we&amp;rsquo;ve been using to create commits is &lt;code&gt;git-commit
-a&lt;/code&gt;, which creates a commit including every change you&amp;rsquo;ve made to your working tree. But what if you want to commit changes only to certain files? Or only certain changes to certain files?" onmousemove="i18n(this)">&Ocy;&scy;&ncy;&ocy;&vcy;&ncy;&ycy;&mcy; &icy;&ncy;&scy;&tcy;&rcy;&ucy;&mcy;&iecy;&ncy;&tcy;&ocy;&mcy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &mcy;&ycy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&lcy;&icy; &dcy;&lcy;&yacy; &scy;&ocy;&zcy;&dcy;&acy;&ncy;&icy;&yacy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&vcy;, &yacy;&vcy;&lcy;&yacy;&iecy;&tcy;&scy;&yacy;  <code>git-commit
-a</code> , &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &scy;&ocy;&zcy;&dcy;&acy;&iecy;&tcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;, &vcy;&kcy;&lcy;&yucy;&chcy;&acy;&yucy;&shchcy;&icy;&jcy; &vcy;&scy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &vcy;&ncy;&iecy;&scy;&iecy;&ncy;&ncy;&ycy;&iecy; &vcy;&acy;&mcy;&icy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&iecy; &dcy;&iecy;&rcy;&iecy;&vcy;&ocy;. &Ncy;&ocy; &chcy;&tcy;&ocy;, &iecy;&scy;&lcy;&icy; &vcy;&ycy; &khcy;&ocy;&tcy;&icy;&tcy;&iecy; &zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ocy;&vcy;&acy;&tcy;&softcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &tcy;&ocy;&lcy;&softcy;&kcy;&ocy; &vcy; &ocy;&pcy;&rcy;&iecy;&dcy;&iecy;&lcy;&iecy;&ncy;&ncy;&ycy;&khcy; &fcy;&acy;&jcy;&lcy;&acy;&khcy;? &Icy;&lcy;&icy; &tcy;&ocy;&lcy;&softcy;&kcy;&ocy; &ocy;&pcy;&rcy;&iecy;&dcy;&iecy;&lcy;&iecy;&ncy;&ncy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &ocy;&pcy;&rcy;&iecy;&dcy;&iecy;&lcy;&iecy;&ncy;&ncy;&ycy;&khcy; &fcy;&acy;&jcy;&lcy;&acy;&khcy;?</span></p> <p><span data-i18n="903334d002e2152cde3f67a85245c98ce8343b5f32d58b9607856d50a135db9a/27" data-source="If we look at the way commits are created under the cover, we&amp;rsquo;ll see that there are more flexible ways creating commits." onmousemove="i18n(this)">&IEcy;&scy;&lcy;&icy; &mcy;&ycy; &pcy;&ocy;&scy;&mcy;&ocy;&tcy;&rcy;&icy;&mcy; &ncy;&acy; &tcy;&ocy;, &kcy;&acy;&kcy; &scy;&ocy;&zcy;&dcy;&acy;&yucy;&tcy;&scy;&yacy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ycy;, &mcy;&ycy; &ucy;&vcy;&icy;&dcy;&icy;&mcy;, &chcy;&tcy;&ocy; &scy;&ucy;&shchcy;&iecy;&scy;&tcy;&vcy;&ucy;&yucy;&tcy; &bcy;&ocy;&lcy;&iecy;&iecy; &gcy;&icy;&bcy;&kcy;&icy;&iecy; &scy;&pcy;&ocy;&scy;&ocy;&bcy;&ycy; &scy;&ocy;&zcy;&dcy;&acy;&ncy;&icy;&yacy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&vcy;.</span></p> <p><span data-i18n="81a9a29217d9e1ad752fd213ea1df21bb9fbbd7431465d06a584d706feda495e/bc" data-source="Continuing with our test-project, let&amp;rsquo;s modify file.txt again:" onmousemove="i18n(this)">&Pcy;&rcy;&ocy;&dcy;&ocy;&lcy;&zhcy;&acy;&yacy; &ncy;&acy;&shcy; &tcy;&iecy;&scy;&tcy;&ocy;&vcy;&ycy;&jcy; &pcy;&rcy;&ocy;&iecy;&kcy;&tcy;, &dcy;&acy;&vcy;&acy;&jcy;&tcy;&iecy; &iecy;&shchcy;&iecy; &rcy;&acy;&zcy; &icy;&zcy;&mcy;&iecy;&ncy;&icy;&mcy; &fcy;&acy;&jcy;&lcy; file.txt:</span></p> <div> <div> <pre class="hljs language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">&quot;hello world, again&quot;</span> &gt;&gt;file.txt</span></pre> </div> </div> <p><span data-i18n="2efb1d206ac4c097aa78be4fad51013150e566ca2c3ea4cfe74c6bbd7ab97009/a6" data-source="but this time instead of immediately making the commit, let&amp;rsquo;s take an intermediate step, and ask for diffs along the way to keep track of what&amp;rsquo;s happening:" onmousemove="i18n(this)">&ncy;&ocy; &ncy;&acy; &ecy;&tcy;&ocy;&tcy; &rcy;&acy;&zcy; &vcy;&mcy;&iecy;&scy;&tcy;&ocy; &tcy;&ocy;&gcy;&ocy;, &chcy;&tcy;&ocy;&bcy;&ycy; &scy;&rcy;&acy;&zcy;&ucy; &dcy;&iecy;&lcy;&acy;&tcy;&softcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;, &dcy;&acy;&vcy;&acy;&jcy;&tcy;&iecy; &scy;&dcy;&iecy;&lcy;&acy;&iecy;&mcy; &pcy;&rcy;&ocy;&mcy;&iecy;&zhcy;&ucy;&tcy;&ocy;&chcy;&ncy;&ycy;&jcy; &shcy;&acy;&gcy; &icy; &zcy;&acy;&pcy;&rcy;&ocy;&scy;&icy;&mcy; &rcy;&acy;&zcy;&lcy;&icy;&chcy;&icy;&yacy; &pcy;&ocy; &pcy;&ucy;&tcy;&icy;, &chcy;&tcy;&ocy;&bcy;&ycy; &ocy;&tcy;&scy;&lcy;&iecy;&zhcy;&icy;&vcy;&acy;&tcy;&softcy;, &chcy;&tcy;&ocy; &pcy;&rcy;&ocy;&icy;&scy;&khcy;&ocy;&dcy;&icy;&tcy;:</span></p> <div> <div> <pre class="hljs language-diff">$ git diff
<span class="hljs-comment">--- a/file.txt</span>
<span class="hljs-comment">+++ b/file.txt</span>
@@ -1 +1,2 @@
 hello world!
<span class="hljs-addition">+hello world, again</span>
$ git add file.txt
$ git diff</pre> </div> </div> <p><span data-i18n="18a2821008e3e3f450c1be5a78e7fba560f5eda9995e1b8d970999e52abbdcd2/e2" data-source="The last diff is empty, but no new commits have been made, and the head still doesn&amp;rsquo;t contain the new line:" onmousemove="i18n(this)">&Pcy;&ocy;&scy;&lcy;&iecy;&dcy;&ncy;&icy;&jcy; &dcy;&icy;&fcy;&fcy; &pcy;&ucy;&scy;&tcy;, &ncy;&ocy; &ncy;&ocy;&vcy;&ycy;&khcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&vcy; &scy;&dcy;&iecy;&lcy;&acy;&ncy;&ocy; &ncy;&iecy; &bcy;&ycy;&lcy;&ocy;, &acy; &vcy; &zcy;&acy;&gcy;&ocy;&lcy;&ocy;&vcy;&kcy;&iecy; &pcy;&ocy;-&pcy;&rcy;&iecy;&zhcy;&ncy;&iecy;&mcy;&ucy; &ncy;&iecy;&tcy; &ncy;&ocy;&vcy;&ocy;&jcy; &scy;&tcy;&rcy;&ocy;&kcy;&icy;:</span></p> <div> <div> <pre class="hljs language-diff">$ git diff HEAD
<span class="hljs-comment">diff --git a/file.txt b/file.txt</span>
<span class="hljs-comment">index a042389..513feba 100644</span>
<span class="hljs-comment">--- a/file.txt</span>
<span class="hljs-comment">+++ b/file.txt</span>
@@ -1 +1,2 @@
 hello world!
<span class="hljs-addition">+hello world, again</span></pre> </div> </div> <p><span data-i18n="49fb92d8076881a4d811ffc8de497857f8d4122d84842e0d7f0036b5f5926fb7/ef" data-source="So &lt;code&gt;git diff&lt;/code&gt; is comparing against something other than the head. The thing that it&amp;rsquo;s comparing against is actually the index file, which is stored in .git/index in a binary format, but whose contents we can examine with ls-files:" onmousemove="i18n(this)">&Tcy;&acy;&kcy; &chcy;&tcy;&ocy;  <code>git diff</code>  &scy;&rcy;&acy;&vcy;&ncy;&icy;&vcy;&acy;&iecy;&tcy;&scy;&yacy; &scy; &chcy;&iecy;&mcy;-&tcy;&ocy; &dcy;&rcy;&ucy;&gcy;&icy;&mcy;, &kcy;&rcy;&ocy;&mcy;&iecy; &gcy;&ocy;&lcy;&ocy;&vcy;&ycy;. &Tcy;&ocy;, &scy; &chcy;&iecy;&mcy; &ocy;&ncy; &scy;&rcy;&acy;&vcy;&ncy;&icy;&vcy;&acy;&iecy;&tcy;&scy;&yacy;, &ncy;&acy; &scy;&acy;&mcy;&ocy;&mcy; &dcy;&iecy;&lcy;&iecy; &yacy;&vcy;&lcy;&yacy;&iecy;&tcy;&scy;&yacy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ycy;&mcy; &fcy;&acy;&jcy;&lcy;&ocy;&mcy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &khcy;&rcy;&acy;&ncy;&icy;&tcy;&scy;&yacy; &vcy; .git/index &vcy; &dcy;&vcy;&ocy;&icy;&chcy;&ncy;&ocy;&mcy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&iecy;, &ncy;&ocy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ocy;&iecy; &kcy;&ocy;&tcy;&ocy;&rcy;&ocy;&gcy;&ocy; &mcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&mcy; &pcy;&rcy;&ocy;&vcy;&iecy;&rcy;&icy;&tcy;&softcy; &scy; &pcy;&ocy;&mcy;&ocy;&shchcy;&softcy;&yucy; ls-&fcy;&acy;&jcy;&lcy;&ocy;&vcy;:</span></p> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git ls-files --stage
<span class="hljs-number">100644</span> 513feba2e53ebbd2532419ded848ba19de88ba00 <span class="hljs-number">0</span>       file.txt
<span class="hljs-variable">$ </span>git cat-file -t 513feba2
blob
<span class="hljs-variable">$ </span>git cat-file blob 513feba2
hello world!
hello world, again</pre> </div> </div> <p><span data-i18n="7bc5a556bd3ae5cabbc6037726d3daee61ceed08cc9bd4e596f6467e4e111de3/09" data-source="So what our &lt;code&gt;git add&lt;/code&gt; did was store a new blob and then put a reference to it in the index file. If we modify the file again, we&amp;rsquo;ll see that the new modifications are reflected in the &lt;code&gt;git diff&lt;/code&gt; output:" onmousemove="i18n(this)">&Icy;&tcy;&acy;&kcy;, &ncy;&acy;&shcy;  <code>git add</code>  &scy;&ocy;&khcy;&rcy;&acy;&ncy;&icy;&lcy; &ncy;&ocy;&vcy;&ycy;&jcy; &bcy;&ocy;&lcy;&softcy;&shcy;&ocy;&jcy; &dcy;&vcy;&ocy;&icy;&chcy;&ncy;&ycy;&jcy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;, &acy; &zcy;&acy;&tcy;&iecy;&mcy; &pcy;&ocy;&mcy;&iecy;&scy;&tcy;&icy;&lcy; &scy;&scy;&ycy;&lcy;&kcy;&ucy; &ncy;&acy; &ncy;&iecy;&gcy;&ocy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ycy;&jcy; &fcy;&acy;&jcy;&lcy;. &IEcy;&scy;&lcy;&icy; &mcy;&ycy; &icy;&zcy;&mcy;&iecy;&ncy;&icy;&mcy; &fcy;&acy;&jcy;&lcy; &iecy;&shchcy;&iecy; &rcy;&acy;&zcy;, &mcy;&ycy; &ucy;&vcy;&icy;&dcy;&icy;&mcy;, &chcy;&tcy;&ocy; &ncy;&ocy;&vcy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &ocy;&tcy;&rcy;&acy;&zhcy;&iecy;&ncy;&ycy; &vcy; &vcy;&ycy;&vcy;&ocy;&dcy;&iecy;  <code>git diff</code> :</span></p> <div> <div> <pre class="hljs language-diff">$ echo &apos;again?&apos; &gt;&gt;file.txt
$ git diff
<span class="hljs-comment">index 513feba..ba3da7b 100644</span>
<span class="hljs-comment">--- a/file.txt</span>
<span class="hljs-comment">+++ b/file.txt</span>
<span class="hljs-meta">@@ -1,2 +1,3 @@</span>
 hello world!
 hello world, again
<span class="hljs-addition">+again?</span></pre> </div> </div> <p><span data-i18n="d3e9cb33efc7e99e343d8b6b58e540f10ccd798a21212d69ce9725f1b6f69393/a8" data-source="With the right arguments, &lt;code&gt;git diff&lt;/code&gt; can also show us the difference between the working directory and the last commit, or between the index and the last commit:" onmousemove="i18n(this)">&Pcy;&rcy;&icy; &pcy;&rcy;&acy;&vcy;&icy;&lcy;&softcy;&ncy;&ycy;&khcy; &acy;&rcy;&gcy;&ucy;&mcy;&iecy;&ncy;&tcy;&acy;&khcy;  <code>git diff</code>  &tcy;&acy;&kcy;&zhcy;&iecy; &mcy;&ocy;&zhcy;&iecy;&tcy; &pcy;&ocy;&kcy;&acy;&zcy;&acy;&tcy;&softcy; &ncy;&acy;&mcy; &rcy;&acy;&zcy;&ncy;&icy;&tscy;&ucy; &mcy;&iecy;&zhcy;&dcy;&ucy; &rcy;&acy;&bcy;&ocy;&chcy;&icy;&mcy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&ocy;&mcy; &icy; &pcy;&ocy;&scy;&lcy;&iecy;&dcy;&ncy;&icy;&mcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&mcy; &icy;&lcy;&icy; &mcy;&iecy;&zhcy;&dcy;&ucy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ocy;&mcy; &icy; &pcy;&ocy;&scy;&lcy;&iecy;&dcy;&ncy;&icy;&mcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&mcy;:</span></p> <div> <div> <pre class="hljs language-diff">$ git diff HEAD
<span class="hljs-comment">diff --git a/file.txt b/file.txt</span>
<span class="hljs-comment" title="index a042389..ba3da7b 100644">&icy;&ncy;&dcy;&iecy;&kcy;&scy; a042389..ba3da7b 100644</span>
<span class="hljs-comment">--- a/file.txt</span>
<span class="hljs-comment">+++ b/file.txt</span>
@@ -1 +1,3 @@
 hello world!
<span class="hljs-addition">+hello world, again</span>
<span class="hljs-addition">+again?</span>
$ git diff --cached
<span class="hljs-comment">diff --git a/file.txt b/file.txt</span>
<span class="hljs-comment" title="index a042389..513feba 100644">&icy;&ncy;&dcy;&iecy;&kcy;&scy; a042389..513feba 100644</span>
<span class="hljs-comment">--- a/file.txt</span>
<span class="hljs-comment">+++ b/file.txt</span>
@@ -1 +1,2 @@
 hello world!
<span class="hljs-addition">+hello world, again</span></pre> </div> </div> <p><span data-i18n="8a555cd4193e452eb53586070750df561ae28bf9a71710816b2c1dd5a1c469d3/33" data-source="At any time, we can create a new commit using &lt;code&gt;git commit&lt;/code&gt; (without the &amp;quot;-a&amp;quot; option), and verify that the state committed only includes the changes stored in the index file, not the additional change that is still only in our working tree:" onmousemove="i18n(this)">&Vcy; &lcy;&yucy;&bcy;&ocy;&jcy; &mcy;&ocy;&mcy;&iecy;&ncy;&tcy; &mcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&mcy; &scy;&ocy;&zcy;&dcy;&acy;&tcy;&softcy; &ncy;&ocy;&vcy;&ucy;&yucy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&yucy;, &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&yacy;  <code>git commit</code>  (&bcy;&iecy;&zcy; &ocy;&pcy;&tscy;&icy;&icy;  &quot;-a&quot; ), &icy; &ucy;&bcy;&iecy;&dcy;&icy;&tcy;&softcy;&scy;&yacy;, &chcy;&tcy;&ocy; &zcy;&acy;&fcy;&icy;&kcy;&scy;&icy;&rcy;&ocy;&vcy;&acy;&ncy;&ncy;&ocy;&iecy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&iecy; &vcy;&kcy;&lcy;&yucy;&chcy;&acy;&iecy;&tcy; &tcy;&ocy;&lcy;&softcy;&kcy;&ocy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &khcy;&rcy;&acy;&ncy;&yacy;&shchcy;&icy;&iecy;&scy;&yacy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ocy;&mcy; &fcy;&acy;&jcy;&lcy;&iecy;, &acy; &ncy;&iecy; &dcy;&ocy;&pcy;&ocy;&lcy;&ncy;&icy;&tcy;&iecy;&lcy;&softcy;&ncy;&ycy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &vcy;&scy;&iecy; &iecy;&shchcy;&iecy; &iecy;&scy;&tcy;&softcy; &tcy;&ocy;&lcy;&softcy;&kcy;&ocy; &vcy; &ncy;&acy;&shcy;&iecy;&mcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;:</span></p> <div> <div> <pre class="hljs language-diff">$ git commit -m &quot;repeat&quot;
$ git diff HEAD
<span class="hljs-comment">diff --git a/file.txt b/file.txt</span>
<span class="hljs-comment" title="index 513feba..ba3da7b 100644">&icy;&ncy;&dcy;&iecy;&kcy;&scy; 513feba..ba3da7b 100644</span>
<span class="hljs-comment">--- a/file.txt</span>
<span class="hljs-comment">+++ b/file.txt</span>
<span class="hljs-meta">@@ -1,2 +1,3 @@</span>
 hello world!
 hello world, again
<span class="hljs-addition">+again?</span></pre> </div> </div> <p><span data-i18n="2d9366376d855be10735594c41c523e106bd749e6072ce3fae244aa6682ff732/4a" data-source="So by default &lt;code&gt;git commit&lt;/code&gt; uses the index to create the commit, not the working tree; the &amp;quot;-a&amp;quot; option to commit tells it to first update the index with all changes in the working tree." onmousemove="i18n(this)">&Tcy;&acy;&kcy;&icy;&mcy; &ocy;&bcy;&rcy;&acy;&zcy;&ocy;&mcy;, &pcy;&ocy; &ucy;&mcy;&ocy;&lcy;&chcy;&acy;&ncy;&icy;&yucy;  <code>git commit</code>  &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&iecy;&tcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; &dcy;&lcy;&yacy; &scy;&ocy;&zcy;&dcy;&acy;&ncy;&icy;&yacy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;, &acy; &ncy;&iecy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&gcy;&ocy; &dcy;&iecy;&rcy;&iecy;&vcy;&acy;; &ocy;&pcy;&tscy;&icy;&yacy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;  &quot;-a&quot;  &ucy;&kcy;&acy;&zcy;&ycy;&vcy;&acy;&iecy;&tcy; &iecy;&mcy;&ucy; &scy;&ncy;&acy;&chcy;&acy;&lcy;&acy; &ocy;&bcy;&ncy;&ocy;&vcy;&icy;&tcy;&softcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy; &scy;&ocy; &vcy;&scy;&iecy;&mcy;&icy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy;&mcy;&icy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &dcy;&iecy;&rcy;&iecy;&vcy;&iecy;.</span></p> <p><span data-i18n="6842e885961dd31c09ab232df965451163ceefd5253e7b524eae6b44fc9000b9/2e" data-source="Finally, it&amp;rsquo;s worth looking at the effect of &lt;code&gt;git add&lt;/code&gt; on the index file:" onmousemove="i18n(this)">&Ncy;&acy;&kcy;&ocy;&ncy;&iecy;&tscy;, &scy;&tcy;&ocy;&icy;&tcy; &pcy;&ocy;&scy;&mcy;&ocy;&tcy;&rcy;&iecy;&tcy;&softcy; &ncy;&acy; &vcy;&lcy;&icy;&yacy;&ncy;&icy;&iecy;  <code>git add</code>  &ncy;&acy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ycy;&jcy; &fcy;&acy;&jcy;&lcy;:</span></p> <div> <div> <pre class="hljs language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">&quot;goodbye, world&quot;</span> &gt;closing.txt</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">git add closing.txt</span></pre> </div> </div> <p><span data-i18n="8ec3e1834d59021bddea39a98a7f7b0f45cdf7b466fe315675e828f75363ad4c/5d" data-source="The effect of the &lt;code&gt;git add&lt;/code&gt; was to add one entry to the index file:" onmousemove="i18n(this)">&Ecy;&fcy;&fcy;&iecy;&kcy;&tcy;&ocy;&mcy;  <code>git add</code>  &bcy;&ycy;&lcy;&ocy; &dcy;&ocy;&bcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&iecy; &ocy;&dcy;&ncy;&ocy;&jcy; &zcy;&acy;&pcy;&icy;&scy;&icy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ycy;&jcy; &fcy;&acy;&jcy;&lcy;:</span></p> <div> <div> <pre class="hljs language-lua">$ git ls-files <span class="hljs-comment">--stage</span>
<span class="hljs-number">100644</span> <span class="hljs-number">8</span>b9743b20d4b15be3955fc8d5cd2b09cd2336138 <span class="hljs-number">0</span>       closing.txt
<span class="hljs-number">100644</span> <span class="hljs-number">513</span>feba2e53ebbd2532419ded848ba19de88ba00 <span class="hljs-number">0</span>       file.txt</pre> </div> </div> <p><span data-i18n="c8613590d258d489a6a3ac0d62cc943500270760b77d2da341495875ddeca98b/01" data-source="And, as you can see with cat-file, this new entry refers to the current contents of the file:" onmousemove="i18n(this)">&Icy;, &kcy;&acy;&kcy; &vcy;&ycy; &mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &vcy;&icy;&dcy;&iecy;&tcy;&softcy; &ncy;&acy; &pcy;&rcy;&icy;&mcy;&iecy;&rcy;&iecy; cat-file, &ecy;&tcy;&acy; &ncy;&ocy;&vcy;&acy;&yacy; &zcy;&acy;&pcy;&icy;&scy;&softcy; &ocy;&tcy;&ncy;&ocy;&scy;&icy;&tcy;&scy;&yacy; &kcy; &tcy;&iecy;&kcy;&ucy;&shchcy;&iecy;&mcy;&ucy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ocy;&mcy;&ucy; &fcy;&acy;&jcy;&lcy;&acy;:</span></p> <div> <div> <pre class="hljs language-ruby"><span class="hljs-variable">$ </span>git cat-file blob 8b9743b2
goodbye, world</pre> </div> </div> <p><span data-i18n="d319c0fce0d51596dae5cab64784456381bdf85923cf417444715eaf6c029316/10" data-source="The &amp;quot;status&amp;quot; command is a useful way to get a quick summary of the situation:" onmousemove="i18n(this)">&Kcy;&ocy;&mcy;&acy;&ncy;&dcy;&acy;  &quot;status&quot;  &mdash; &pcy;&ocy;&lcy;&iecy;&zcy;&ncy;&ycy;&jcy; &scy;&pcy;&ocy;&scy;&ocy;&bcy; &pcy;&ocy;&lcy;&ucy;&chcy;&icy;&tcy;&softcy; &kcy;&rcy;&acy;&tcy;&kcy;&ucy;&yucy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&yucy; &ocy; &scy;&icy;&tcy;&ucy;&acy;&tscy;&icy;&icy;:</span></p> <div> <div> <pre class="hljs language-rust">$ git status
On branch master
Changes to be committed:
  (<span class="hljs-keyword">use</span> <span class="hljs-string">&quot;git restore --staged &lt;file&gt;...&quot;</span> to unstage)

        new file:   closing.txt

Changes not staged <span class="hljs-keyword">for</span> <span class="hljs-title class_">commit</span>:
  (<span class="hljs-keyword">use</span> <span class="hljs-string">&quot;git add &lt;file&gt;...&quot;</span> to update what will be committed)
  (<span class="hljs-keyword">use</span> <span class="hljs-string">&quot;git restore &lt;file&gt;...&quot;</span> to discard changes <span class="hljs-keyword">in</span> working directory)

        modified:   file.txt</pre> </div> </div> <p><span data-i18n="e7fc6905036f99821f5b32ef85f59fbeb6b45cbe8486369f92f600824f2fa399/d3" data-source="Since the current state of closing.txt is cached in the index file, it is listed as &amp;quot;Changes to be committed&amp;quot;. Since file.txt has changes in the working directory that aren&amp;rsquo;t reflected in the index, it is marked &amp;quot;changed but not updated&amp;quot;. At this point, running &amp;quot;git commit&amp;quot; would create a commit that added closing.txt (with its new contents), but that didn&amp;rsquo;t modify file.txt." onmousemove="i18n(this)">&Pcy;&ocy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ucy; &tcy;&iecy;&kcy;&ucy;&shchcy;&iecy;&iecy; &scy;&ocy;&scy;&tcy;&ocy;&yacy;&ncy;&icy;&iecy; &fcy;&acy;&jcy;&lcy;&acy; close.txt &kcy;&ecy;&shcy;&icy;&rcy;&ucy;&iecy;&tcy;&scy;&yacy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ocy;&mcy; &fcy;&acy;&jcy;&lcy;&iecy;, &ocy;&ncy;&ocy; &ucy;&kcy;&acy;&zcy;&acy;&ncy;&ocy; &kcy;&acy;&kcy;  &quot;Changes to be committed&quot; . &Pcy;&ocy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ucy; &fcy;&acy;&jcy;&lcy; file.txt &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&tcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&iecy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &ncy;&iecy; &ocy;&tcy;&rcy;&acy;&zhcy;&iecy;&ncy;&ycy; &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&iecy;, &ocy;&ncy; &pcy;&ocy;&mcy;&iecy;&chcy;&iecy;&ncy; &kcy;&acy;&kcy;  &quot;changed but not updated&quot; . &Ncy;&acy; &ecy;&tcy;&ocy;&mcy; &ecy;&tcy;&acy;&pcy;&iecy; &zcy;&acy;&pcy;&ucy;&scy;&kcy;  &quot;git commit&quot;  &scy;&ocy;&zcy;&dcy;&acy;&scy;&tcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&jcy; &dcy;&ocy;&bcy;&acy;&vcy;&icy;&tcy; &fcy;&acy;&jcy;&lcy; close.txt (&scy; &iecy;&gcy;&ocy; &ncy;&ocy;&vcy;&ycy;&mcy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&mcy;&ycy;&mcy;), &ncy;&ocy; &ncy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&icy;&tcy; &fcy;&acy;&jcy;&lcy; file.txt.</span></p> <p><span data-i18n="1924de3e18ece3e1db741780d86436bfeb0d0ca4f394fcac222d4b17e8833b6d/0f" data-source="Also, note that a bare &lt;code&gt;git diff&lt;/code&gt; shows the changes to file.txt, but not the addition of closing.txt, because the version of closing.txt in the index file is identical to the one in the working directory." onmousemove="i18n(this)">&Tcy;&acy;&kcy;&zhcy;&iecy; &ocy;&bcy;&rcy;&acy;&tcy;&icy;&tcy;&iecy; &vcy;&ncy;&icy;&mcy;&acy;&ncy;&icy;&iecy;, &chcy;&tcy;&ocy; &pcy;&ucy;&scy;&tcy;&ocy;&jcy;  <code>git diff</code>  &pcy;&ocy;&kcy;&acy;&zcy;&ycy;&vcy;&acy;&iecy;&tcy; &icy;&zcy;&mcy;&iecy;&ncy;&iecy;&ncy;&icy;&yacy; &vcy; &fcy;&acy;&jcy;&lcy;&iecy; file.txt, &ncy;&ocy; &ncy;&iecy; &dcy;&ocy;&bcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&iecy; &fcy;&acy;&jcy;&lcy;&acy; close.txt, &pcy;&ocy;&scy;&kcy;&ocy;&lcy;&softcy;&kcy;&ucy; &vcy;&iecy;&rcy;&scy;&icy;&yacy; &fcy;&acy;&jcy;&lcy;&acy; close.txt &vcy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ocy;&mcy; &fcy;&acy;&jcy;&lcy;&iecy; &icy;&dcy;&iecy;&ncy;&tcy;&icy;&chcy;&ncy;&acy; &vcy;&iecy;&rcy;&scy;&icy;&icy; &vcy; &rcy;&acy;&bcy;&ocy;&chcy;&iecy;&mcy; &kcy;&acy;&tcy;&acy;&lcy;&ocy;&gcy;&iecy;.</span></p> <p><span data-i18n="c69f3437a8b9841b951c563758f46e740661182fff7e5bfad77b104fbfca31ad/15" data-source="In addition to being the staging area for new commits, the index file is also populated from the object database when checking out a branch, and is used to hold the trees involved in a merge operation. See &lt;a href=&quot;gitcore-tutorial&quot;&gt;gitcore-tutorial[7]&lt;/a&gt; and the relevant man pages for details." onmousemove="i18n(this)">&Pcy;&ocy;&mcy;&icy;&mcy;&ocy; &tcy;&ocy;&gcy;&ocy;, &chcy;&tcy;&ocy; &icy;&ncy;&dcy;&iecy;&kcy;&scy;&ncy;&ycy;&jcy; &fcy;&acy;&jcy;&lcy; &yacy;&vcy;&lcy;&yacy;&iecy;&tcy;&scy;&yacy; &pcy;&rcy;&ocy;&mcy;&iecy;&zhcy;&ucy;&tcy;&ocy;&chcy;&ncy;&ocy;&jcy; &ocy;&bcy;&lcy;&acy;&scy;&tcy;&softcy;&yucy; &dcy;&lcy;&yacy; &ncy;&ocy;&vcy;&ycy;&khcy; &kcy;&ocy;&mcy;&mcy;&icy;&tcy;&ocy;&vcy;, &ocy;&ncy; &tcy;&acy;&kcy;&zhcy;&iecy; &zcy;&acy;&pcy;&ocy;&lcy;&ncy;&yacy;&iecy;&tcy;&scy;&yacy; &icy;&zcy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ncy;&ocy;&jcy; &bcy;&acy;&zcy;&ycy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy; &pcy;&rcy;&icy; &icy;&zcy;&vcy;&lcy;&iecy;&chcy;&iecy;&ncy;&icy;&icy; &vcy;&iecy;&tcy;&kcy;&icy; &icy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&iecy;&tcy;&scy;&yacy; &dcy;&lcy;&yacy; &khcy;&rcy;&acy;&ncy;&iecy;&ncy;&icy;&yacy; &dcy;&iecy;&rcy;&iecy;&vcy;&softcy;&iecy;&vcy;, &ucy;&chcy;&acy;&scy;&tcy;&vcy;&ucy;&yucy;&shchcy;&icy;&khcy; &vcy; &ocy;&pcy;&iecy;&rcy;&acy;&tscy;&icy;&icy; &scy;&lcy;&icy;&yacy;&ncy;&icy;&yacy;. &Pcy;&ocy;&dcy;&rcy;&ocy;&bcy;&ncy;&ocy;&scy;&tcy;&icy; &scy;&mcy;. &vcy;  <a href="gitcore-tutorial.html">gitcore-tutorial[7]</a>  &icy; &ncy;&acy; &scy;&ocy;&ocy;&tcy;&vcy;&iecy;&tcy;&scy;&tcy;&vcy;&ucy;&yucy;&shchcy;&icy;&khcy; &scy;&tcy;&rcy;&acy;&ncy;&icy;&tscy;&acy;&khcy; &rcy;&ucy;&kcy;&ocy;&vcy;&ocy;&dcy;&scy;&tcy;&vcy;&acy;.</span></p> </div> <h2 class="text-body-emphasis"  id="_what_next"><span data-i18n="5c8fb4742997473ecbfc7ada7340b883e57a222735710fb3421ea9977aa3d410/31" data-source="What next?" onmousemove="i18n(this)">What next?</span></h2> <div> <p><span data-i18n="1639a8fa056d804275ed17e2fa89ce481d59ad4f672d3a7719c0e73e14b4d978/0c" data-source="At this point you should know everything necessary to read the man pages for any of the git commands; one good place to start would be with the commands mentioned in &lt;a href=&quot;giteveryday&quot;&gt;giteveryday[7]&lt;/a&gt;. You should be able to find any unknown jargon in &lt;a href=&quot;gitglossary&quot;&gt;gitglossary[7]&lt;/a&gt;." onmousemove="i18n(this)">&Ncy;&acy; &ecy;&tcy;&ocy;&mcy; &ecy;&tcy;&acy;&pcy;&iecy; &vcy;&ycy; &dcy;&ocy;&lcy;&zhcy;&ncy;&ycy; &zcy;&ncy;&acy;&tcy;&softcy; &vcy;&scy;&iecy; &ncy;&iecy;&ocy;&bcy;&khcy;&ocy;&dcy;&icy;&mcy;&ocy;&iecy; &dcy;&lcy;&yacy; &chcy;&tcy;&iecy;&ncy;&icy;&yacy; &scy;&tcy;&rcy;&acy;&ncy;&icy;&tscy; &rcy;&ucy;&kcy;&ocy;&vcy;&ocy;&dcy;&scy;&tcy;&vcy;&acy; &pcy;&ocy; &lcy;&yucy;&bcy;&ocy;&jcy; &icy;&zcy; &kcy;&ocy;&mcy;&acy;&ncy;&dcy;  git ; &Lcy;&ucy;&chcy;&shcy;&iecy; &vcy;&scy;&iecy;&gcy;&ocy; &ncy;&acy;&chcy;&acy;&tcy;&softcy; &scy; &kcy;&ocy;&mcy;&acy;&ncy;&dcy;, &ucy;&pcy;&ocy;&mcy;&yacy;&ncy;&ucy;&tcy;&ycy;&khcy; &vcy;  <a href="giteveryday.html">giteveryday[7]</a> . &Vcy;&ycy; &scy;&mcy;&ocy;&zhcy;&iecy;&tcy;&iecy; &ncy;&acy;&jcy;&tcy;&icy; &lcy;&yucy;&bcy;&ocy;&jcy; &ncy;&iecy;&icy;&zcy;&vcy;&iecy;&scy;&tcy;&ncy;&ycy;&jcy; &zhcy;&acy;&rcy;&gcy;&ocy;&ncy; &vcy;  <a href="gitglossary.html">gitglossary[7]</a> .</span></p> <p><span data-i18n="b090f2804d2e34dc97a5aacbab6a5af36ff2b42248639a6b9ecd41a578b8cb3b/1c" data-source="The &lt;a href=&quot;user-manual&quot;&gt;Git User&amp;rsquo;s Manual&lt;/a&gt; provides a more comprehensive introduction to Git." onmousemove="i18n(this)"><a href="user-manual.html">Git User&rsquo;s Manual</a>  &ocy;&bcy;&iecy;&scy;&pcy;&iecy;&chcy;&icy;&vcy;&acy;&iecy;&tcy; &bcy;&ocy;&lcy;&iecy;&iecy; &pcy;&ocy;&lcy;&ncy;&ocy;&iecy; &vcy;&vcy;&iecy;&dcy;&iecy;&ncy;&icy;&iecy; &vcy; Git.</span></p> <p><span data-i18n="520830aabe897910f4c68bee3f9ac35e47273673792c0d65917d1e1226046bac/ae" data-source="&lt;a href=&quot;gitcvs-migration&quot;&gt;gitcvs-migration[7]&lt;/a&gt; explains how to import a CVS repository into Git, and shows how to use Git in a CVS-like way." onmousemove="i18n(this)"><a href="gitcvs-migration.html">gitcvs-migration[7]</a>  &ocy;&bcy;&hardcy;&yacy;&scy;&ncy;&yacy;&iecy;&tcy;, &kcy;&acy;&kcy; &icy;&mcy;&pcy;&ocy;&rcy;&tcy;&icy;&rcy;&ocy;&vcy;&acy;&tcy;&softcy; &rcy;&iecy;&pcy;&ocy;&zcy;&icy;&tcy;&ocy;&rcy;&icy;&jcy; CVS &vcy;  Git , &icy; &pcy;&ocy;&kcy;&acy;&zcy;&ycy;&vcy;&acy;&iecy;&tcy;, &kcy;&acy;&kcy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy;  Git  &acy;&ncy;&acy;&lcy;&ocy;&gcy;&icy;&chcy;&ncy;&ocy; CVS.</span></p> <p><span data-i18n="2edaa4f43808de2db47e0efb9a27cd4edd15b2a8872d2922b3f95cc3aaba6aaf/0f" data-source="For some interesting examples of Git use, see the &lt;a href=&quot;howto-index&quot;&gt;howtos&lt;/a&gt;." onmousemove="i18n(this)">&Ncy;&iecy;&kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &icy;&ncy;&tcy;&iecy;&rcy;&iecy;&scy;&ncy;&ycy;&iecy; &pcy;&rcy;&icy;&mcy;&iecy;&rcy;&ycy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&ncy;&icy;&yacy;  Git  &scy;&mcy;. &vcy;  <a href="howto-index.html">howtos</a> .</span></p> <p><span data-i18n="ecea5f082749936849f73f5988c7caba8b795ff569dd4e7f9df836f9f823cc33/66" data-source="For Git developers, &lt;a href=&quot;gitcore-tutorial&quot;&gt;gitcore-tutorial[7]&lt;/a&gt; goes into detail on the lower-level Git mechanisms involved in, for example, creating a new commit." onmousemove="i18n(this)">&Dcy;&lcy;&yacy; &rcy;&acy;&zcy;&rcy;&acy;&bcy;&ocy;&tcy;&chcy;&icy;&kcy;&ocy;&vcy;  Git  &scy;&tcy;&acy;&tcy;&softcy;&yacy;  <a href="gitcore-tutorial.html">gitcore-tutorial[7]</a>  &pcy;&ocy;&dcy;&rcy;&ocy;&bcy;&ncy;&ocy; &ocy;&pcy;&icy;&scy;&ycy;&vcy;&acy;&iecy;&tcy; &mcy;&iecy;&khcy;&acy;&ncy;&icy;&zcy;&mcy;&ycy;  Git  &ncy;&icy;&zhcy;&ncy;&iecy;&gcy;&ocy; &ucy;&rcy;&ocy;&vcy;&ncy;&yacy;, &zcy;&acy;&dcy;&iecy;&jcy;&scy;&tcy;&vcy;&ocy;&vcy;&acy;&ncy;&ncy;&ycy;&iecy;, &ncy;&acy;&pcy;&rcy;&icy;&mcy;&iecy;&rcy;, &pcy;&rcy;&icy; &scy;&ocy;&zcy;&dcy;&acy;&ncy;&icy;&icy; &ncy;&ocy;&vcy;&ocy;&jcy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;.</span></p> </div> <h2 class="text-body-emphasis"  id="_see_also"><span data-i18n="2fa97693b70fa87b95b2d1bdf9558e4ac65d5e82d145f13a03849c4d9c4957a9/40" data-source="See also" onmousemove="i18n(this)">See also</span></h2> <div> <p><span data-i18n="3fd85101784092a6de27399888885df55d313edd15a89b0c417e5ca6b7d53d03/38" data-source="&lt;a href=&quot;gittutorial&quot;&gt;gittutorial[7]&lt;/a&gt;, &lt;a href=&quot;gitcvs-migration&quot;&gt;gitcvs-migration[7]&lt;/a&gt;, &lt;a href=&quot;gitcore-tutorial&quot;&gt;gitcore-tutorial[7]&lt;/a&gt;, &lt;a href=&quot;gitglossary&quot;&gt;gitglossary[7]&lt;/a&gt;, &lt;a href=&quot;git-help&quot;&gt;git-help[1]&lt;/a&gt;, &lt;a href=&quot;giteveryday&quot;&gt;giteveryday[7]&lt;/a&gt;, &lt;a href=&quot;user-manual&quot;&gt;The Git User&amp;rsquo;s Manual&lt;/a&gt;" onmousemove="i18n(this)"><a href="gittutorial.html">gittutorial[7]</a> ,  <a href="gitcvs-migration.html">gitcvs-migration[7]</a> ,  <a href="gitcore-tutorial.html">gitcore-tutorial[7]</a> ,  <a href="gitglossary.html">gitglossary[7]</a> ,  <a href="git-help.html">git-help[1]</a> ,  <a href="giteveryday.html">giteveryday[7]</a> ,  <a href="user-manual.html">The Git User&rsquo;s Manual</a></span></p> </div><address>
<p>
    &copy; 2012&ndash;2024 Scott Chacon and others<br/>Licensed under the MIT License.<br/>
<a href="https://git-scm.com/docs/gittutorial-2">https://git-scm.com/docs/gittutorial-2</a>
</p>
</address>                </article>
            </main>

            <br>
            <br>
            <hr>

                               <ins class="adsbygoogle"
        style="display:block"
        data-ad-format="autorelaxed"
        data-ad-client="ca-pub-6424571640879890"
        data-ad-slot="7867651344"></ins>
   <script>
        (adsbygoogle = window.adsbygoogle || []).push({});
   </script>            
        </div>

        <!-- -->

        <div class="col-md-3">
            <br>
            <form action="-index-.html">
                <div class="input-group">
                    <input class="form-control" type="search" name="q" placeholder="Search for Git" required>
                    <button class="btn btn-primary" type="submit">
                        <i class="bi bi-search"></i>
                    </button>
                </div>
            </form>
            <br>

                            <div class="list-group list-group-flush">
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="gitweb.html">
                            gitweb                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="gitweb.conf.html">
                            gitweb.conf                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="gitworkflows.html">
                            gitworkflows                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="howto-index.html">
                            howto index                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="multi-pack-index.html">
                            multi pack-index                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="partial-clone.html">
                            partial clone                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="scalar.html">
                            scalar                        </a>
                                    </div>
            
            <br>
            <div class="my-3">
                <ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-6424571640879890"
     data-ad-slot="3954319254"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>            </div>
            <br>

            
            
        </div>
    </div>
</div>    <!--/sse-->

    <footer>
        <br>
        <div class="container">
            <div class="row">
                <div class="col">
                    <hr>
                    <div class="row">
                        <div class="col-md-10">
                            <ul class="nav">
                                <li class="nav-item">
                                    <a class="nav-link ps-0" href="https://runebook.dev/">Help us Improve Translation</a>
                                </li>
                                                            </ul>
                        </div>
                        <div class="col-md-2 text-end">
                            <a href="gittutorial-2.html#" class="fs-5" aria-label="Top">
                                <i class="bi bi-arrow-up-square-fill"></i>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <br>
    </footer>
    <script src="../../../runebook.js"></script>
</body>

</html>